#登录页
from selenium.webdriver.common.by import By
from utils.pagebase import PageBase

class PageLogin(PageBase):
    path_url = "/simple/login"
    zhanghaoDW=By.NAME,'login_info'
    mimaDW=By.NAME,'password'
    loginbutton=By.XPATH,'//input[@type="submit"][@value="登录"]'
    DIV=By.CSS_SELECTOR,'div.prompt'
    def __init__(self,driver,base_url):
        PageBase.__init__(self,driver,base_url)

    # 打开网站
    def openurl(self):
        self.open(PageLogin.path_url)

     # 输入账户
    def input_zhanghao(self, zh):
        self.input(PageLogin.zhanghaoDW, zh)

     # 输入密码
    def input_mima(self, pwd):
        self.input(PageLogin.mimaDW, pwd)

        # 点击登录按钮
    def click_loginbutton(self):
        self.mouse_click(PageLogin.loginbutton)

        #获取DIV标签
    def  getDIVtest(self):
        return self.getattr(PageLogin.DIV)

    #获取账号框的class属性值
    def zhanghao_attr(self):
        return self.getattr(PageLogin.zhanghaoDW,'class')

    #获取密码框的class属性值
    def mima_attr(self):
        return self.getattr(PageLogin.mimaDW,'class')

